import request from '@/axios';

export const getList = (current, size, params) => request({
  url: '/zzy-system/dept/list',
  method: 'get',
  params: {
    ...params,
    current,
    size,
  },
});

export const getLazyList = (parentId, params) => request({
  url: '/zzy-system/dept/lazy-list',
  method: 'get',
  params: {
    ...params,
    parentId,
  },
});

export const remove = ids => request({
  url: '/zzy-system/dept/remove',
  method: 'post',
  params: {
    ids,
  },
});

export const add = row => request({
  url: '/zzy-system/dept/submit',
  method: 'post',
  data: row,
});

export const update = row => request({
  url: '/zzy-system/dept/submit',
  method: 'post',
  data: row,
});

export const getDept = id => request({
  url: '/zzy-system/dept/detail',
  method: 'get',
  params: {
    id,
  },
});

export const getDeptTree = tenantId => request({
  url: '/zzy-system/dept/tree',
  method: 'get',
  params: {
    tenantId,
  },
});

export const getDeptLazyTree = parentId => request({
  url: '/zzy-system/dept/lazy-tree',
  method: 'get',
  params: {
    parentId,
  },
});
